<template>
  <el-menu-item index="7" @click="handleRoad">路况信息</el-menu-item>

  <el-dialog
    class="event-table"
    v-model="outerVisible"
    title="路况信息"
    width="45%"
    align-center
  >
    <el-divider />
    <input
      class="top-input"
      type="text"
      placeholder="search"
      v-model="inputvalue"
      @keyup.enter="handleSearch"
    />
    <el-table :data="tableData" style="width: 100%">
      <!-- 用户名 -->
      <el-table-column label="用户名" width="80">
        <template #default="scope">
          <div style="align-items: center">
            <span style="margin-left: 10px">{{ scope.row.user_name }}</span>
          </div>
        </template>
      </el-table-column>
      <!-- 事件类型 -->
      <el-table-column label="事件类型" width="80">
        <template #default="scope">
          <div style="align-items: center">
            <span style="margin-left: 10px">{{ scope.row.event_type }}</span>
          </div>
        </template>
      </el-table-column>
      <!-- 事件地址 -->
      <el-table-column label="事件地址" width="100">
        <template #default="scope">
          <div style="align-items: center">
            <span style="margin-left: 10px">{{ scope.row.event_addr }}</span>
          </div>
        </template>
      </el-table-column>
      <!-- 附近建筑 -->
      <el-table-column label="附近建筑" width="120">
        <template #default="scope">
          <div style="align-items: center">
            <span style="margin-left: 10px">{{ scope.row.event_mark }}</span>
          </div>
        </template>
      </el-table-column>
      <!-- 发生时间 -->
      <el-table-column label="发生时间" width="120">
        <template #default="scope">
          <div style="align-items: center">
            <span style="margin-left: 10px">{{ scope.row.event_time }}</span>
          </div>
        </template>
      </el-table-column>
      <!-- 事件描述 -->
      <el-table-column label="事件描述" width="160">
        <template #default="scope">
          <div style="align-items: center">
            <span style="margin-left: 10px">{{
              scope.row.event_describe
            }}</span>
          </div>
        </template>
      </el-table-column>
      <!-- 操作 -->
      <el-table-column label="操作">
        <template #default="scope">
          <handle-event :a="scope.row.event_id"></handle-event>
        </template>
      </el-table-column>
    </el-table>
  </el-dialog>
</template>

<script setup>
import HandleEvent from "../../views/TrafficView/components/HandleEvent.vue"
import { road } from "../../views/TrafficView/components/hooks/roadmessage.js"
const { handleRoad, tableData, outerVisible, handleSearch, inputvalue } = road()
</script>

<style>
.el-dialog__body {
  padding: 0;
}
.event-table {
  min-width: 850px;
}
</style>

<style scoped>
.el-divider--horizontal {
  margin: 0;
}
.top-input {
  float: right;
  background: none;
  outline: none;
  border: none;
  border: 1px solid #dcdfe6;
  height: 30px;
  padding-left: 10px;
  margin: 10px 20px;
  border-radius: 5px;
  width: 180px;
}
</style>
